package fun.stgoder.easydarwin.jobs.comm.model;

import java.util.ArrayList;
import java.util.List;

public class Param {

    private List<NameValue> params = new ArrayList<>();

    public static class NameValue {
        private String name;
        private Object value;

        public NameValue() {
        }

        public NameValue(String name, Object value) {
            this.name = name;
            this.value = value;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        public Object getValue() {
            return value;
        }

        public void setValue(Object value) {
            this.value = value;
        }
    }

    public Param() {
    }

    public Param(String name, Object value) {
        add(name, value);
    }

    public Param add(String name, Object value) {
        params.add(new NameValue(name, value));
        return this;
    }

    public Param add(Param param) {
        List<NameValue> params = param.params;
        this.params.addAll(params);
        return this;
    }

    public List<NameValue> params() {
        return params;
    }
}
